using Microsoft.Ccr.Core;
using Microsoft.Dss.Core.Attributes;
using Microsoft.Dss.ServiceModel.Dssp;
using Microsoft.Dss.Core.DsspHttp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using W3C.Soap;
using pxdrive = Microsoft.Robotics.Services.Drive.Proxy;
using pxmotor = Microsoft.Robotics.Services.Motor.Proxy;
using Microsoft.Robotics.PhysicalModel;

namespace SimJaguar.QuadDifferentialDrive
{

    /// <summary>
    /// SimulatedQuadDifferentialDrive Contract
    /// </summary>
    public sealed class Contract
    {
        /// The Unique Contract Identifier for the SimulatedQuadDifferentialDrive service
        public const String Identifier = "http://erobots.jcepeda.simquaddiffdrive/2011/09/simulatedquaddifferentialdrive.html";
    }

    [DataContract]
    public class DriveDifferentialFourWheelState : pxdrive.DriveDifferentialTwoWheelState
    {
        private pxmotor.WheeledMotorState _rearLeftWheel;
        private pxmotor.WheeledMotorState _rearRightWheel;
        private Vector3 _position;

        [Description("The rear left wheel's state.")]
        [DataMember]
        public pxmotor.WheeledMotorState RearLeftWheel
        {
            get { return _rearLeftWheel; }
            set { _rearLeftWheel = value; }
        }
        [DataMember]
        [Description("The rear right wheel's state.")]
        public pxmotor.WheeledMotorState RearRightWheel
        {
            get { return _rearRightWheel; }
            set { _rearRightWheel = value; }
        }
        [DataMember]
        [Description("The current position of the entity.")]
        public Vector3 Position
        {
            get { return _position; }
            set { _position = value; }
        }
    }

    /// <summary>
    /// QuadDrive Operations Port
    /// </summary>
    [ServicePort]
    public class QuadDriveOperations : PortSet<DsspDefaultLookup, DsspDefaultDrop, HttpGet, Get, SetPose, Replace, Subscribe>
    {
    }

    /// <summary>
    /// Operation Retrieve Drive State
    /// </summary>
    [Description("Gets the drive's current state.")]
    public class Get : Get<GetRequestType, PortSet<DriveDifferentialFourWheelState, Fault>>
    {
    }

    /// <summary>
    /// Operation Set Entity Pose
    /// </summary>
    [Description("Sets the pose of the quadDifferentialDrive entity.")]
    public class SetPose : Update<SetPoseRequestType, PortSet<DefaultUpdateResponseType, Fault>>
    {
    }

    /// <summary>
    /// Set entity pose request
    /// </summary>
    [DataMemberConstructor]
    [DataContract]
    public class SetPoseRequestType
    {
        Pose _entityPose;

        [DataMember]
        public Pose EntityPose
        {
            get { return _entityPose; }
            set { _entityPose = value; }
        }

        public SetPoseRequestType()
        {
        }
    }

    public class Subscribe : Subscribe<SubscribeRequestType, PortSet<SubscribeResponseType, Fault>>
    {
        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        public Subscribe()
        {
        }

        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        /// <param name="body">the request message body</param>
        public Subscribe(SubscribeRequestType body)
            : base(body)
        {
        }

        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        /// <param name="body">the request message body</param>
        /// <param name="responsePort">the response port for the request</param>
        public Subscribe(SubscribeRequestType body, PortSet<SubscribeResponseType, Fault> responsePort)
            : base(body, responsePort)
        {
        }
    }
    public class Replace : Replace<DriveDifferentialFourWheelState, PortSet<DefaultReplaceResponseType, Fault>>
    {
        public Replace() { }

        public Replace(DriveDifferentialFourWheelState body) : base(body) { }

        public Replace(DriveDifferentialFourWheelState body, PortSet<DefaultReplaceResponseType, Fault> responsePort) : base(body, responsePort) { }

    }
}

